<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
     <meta content="telephone=no" name="format-detection" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable = no"/>
    <title>商品-{$webseting.web_title}</title>
    <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/mbusiness.css"  rel="stylesheet">
</head>
<body>
<!--绑定头部-->
<include file="Public/binding_head"/>
<!--绑定头部-->

<header id="header" class="u-header clearfix">
        <div class="u-hd-left f-left">
            <a href="javascript:history.go(-1);" class="J_backToPrev"><span class="u-icon-px i-hd-back"></span></a>
        </div>
        <div class="u-hd-tit"><span>赚取佣金商品</span></div>
        <div class="u-hd-right f-right"><a href="{:U('wap/goods/category',array('type'=>'made'))}" mars_sead="nav_home_btn"><span class="u-icon-m i-hd-home"></span></a></div>
    </header>
    <div class="filter">
        <ul>
            <li id="listCategory" class="all_chk"><span>全部</span></li>
            <li id="listBrand"><a href="{:U('wap/goods/category',array('type'=>'made'))}"><span>分类{$typename}</span></a></li>
            <li class="zhekou" data="0"><span>价格<i class="p-sx"></i></span></li>
        </ul>
    </div>

    <div class="" style="margin: 10px 10px;">
        <ul class="i_ul rel more_html">

            <volist name="list" id="vo">
            <li class="i_li left">
                <a href="{:U('wap/goods/promo_detail',array('id'=>$vo['goods_id']))}">
                    <div class="i_li_img_div wrap">
                        <div class="i_li_img_div_inner">
                                <span class="sellerOut">
                                    <img src="{:U('wap/index/get_thumbs',array('auto'=>240))}?img={$vo.goods_img}">
                                </span>
                        </div>
                    </div>
                    <p class="i_txt">{$vo.goods_name}</p>
                    <p class="i_pri_wrap">
                        <span class="i_pri"><lable class="lable_yj">佣金</lable>¥
                            <if condition="!empty($vo['low_money']) and !empty($vo['high_money'])">
                                {$vo.low_money}~{$vo.high_money}
                                <else/>
                                {$vo.share_money}
                            </if>
                        </span>
                    </p>
                </a>
            </li>
          </volist>  
        </ul>
    </div>

    <div class="b_q">
        <div class="fm-footer-copyright get_more">
            <if condition="$count gt 10 && count($list) eq 10">
                  加载更多
              <else/>  
                 无更多数据
            </if>
        </div>

    </div>
      <input type="hidden" name="p" data="2" value="2" />
     <input type="hidden" name="type" value="{$_GET['type']}" />
     <input type="hidden" name="order" value="" />
    <!--end 版权-->
    <div class="bottom-to-top" style="display: block; transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);">
        <img src="__PUBLIC__/wap/img/scroll-to-top-icon.png" style="width: 100%;">
    </div>
    <!--end top-->
   <include file="Public/footer" />
    <!--end 页脚-->
<include file="Public/wap_javascript"/>

<!--微信分享-->    
 <include file="Public/share_weixin" />

<script type="text/javascript">
    var binding_is_check = 0;// 重复再次弹出 1是 0否
    var binding_page = 'goods_made';// //当前页面名称 不可重复
</script>
<!--绑定-->
<include file="Public/binding_phone"/>
<!--绑定-->
<script type="text/javascript">
 var load_more=0;
 var load_none=0;
$(function(){
     $(window).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if (scrollTop + windowHeight == scrollHeight) {
              //此处是滚动条到底部时候触发的事件，在这里写要加载的数据，或者是拉动滚动条的操作
              if(load_none!=1){
                  if(load_more==1){
                    var html=' <img src="__PUBLIC__/wap/img/icon_zhuan.gif" style="max-width:15px;">'
                    $('.get_more').html('加载中'+html);
                 }else{
                    get_more();
                 }
              }
        
        }
    });
})
   $(function(){
     $(".get_more").click(function(){
        get_more();
     });
     $(".all_chk").click(function(){
        //$("input[name='p']").val(1);
        $("input[name='p']").attr('data',1);
        $("input[name='type']").val("");
        get_more();
     });
     $(".zhekou").click(function(){
        var data=$(this).attr('data');
        var zk="";
        if(data==1){
             $(this).find('i').addClass('p-sx-x');
            $(this).find('i').removeClass('p-sx-s');
            $(this).attr('data','2')
             zk="prices1";
        }else{
             $(this).find('i').addClass('p-sx-s');
            $(this).find('i').removeClass('p-sx-x');
          $(this).attr('data','1')
          zk="prices2";
        }
        //$("input[name='p']").val(1);
        $("input[name='p']").attr('data',1);
        $("input[name='order']").val(zk);
        get_more();
     });
   }); 
   function get_more(){
    load_more=1;
    var html=' <img src="__PUBLIC__/wap/img/icon_zhuan.gif" style="max-width:15px;">'
     $('.get_more').html('加载中'+html);
     //var p=$("input[name='p']").val();
      var p=$("input[name='p']").attr('data');
     var type=$("input[name='type']").val();
     var order=$("input[name='order']").val();
           $.ajax({ 
            url: "{:U('wap/goods/made')}",
            type:'get',
            data: {p:p,type:type,order:order},
            dataType: 'json',
            success: function(data){
              //console.log(data);
               var con=1;
              var option='';
              if(data){
                 $.each(data, function(i, value) {
                //this指向当前元素
                //i表示Array当前下标
                //value表示Array当前元素
                     if(typeof(this.low_money) !='undefined' && typeof(this.high_money) !='undefined'){
                         var share_money=this.low_money+'~'+this.high_money;
                     }else{
                        var share_money=this.share_money;
                     }
                 option=option+' <li class="i_li left">'
                +'<a href="<?php echo U('wap/goods/promo_detail'); ?>?id='+value.goods_id+'">'
                +'    <div class="i_li_img_div wrap">'
                 +'       <div class="i_li_img_div_inner">'
                +'                <span class="sellerOut">'
                +'                    <img src="<?php echo U('wap/index/get_thumbs',array('auto'=>240)); ?>?img='+value.goods_img+'">'
                +'                </span>'
                +'        </div>'
                +'    </div>'
                +'    <p class="i_txt">'+value.goods_name+'</p>'
                +'    <p class="i_pri_wrap">'
                +'        <span class="i_pri"><lable class="lable_yj">佣金</lable>¥'+share_money+'</span>'
                +'    </p>'
               +' </a>'
               +' </li>';
                    con++;
                 });
                }
              //$('.more_html').append(option);
                if(p==1){
                $('.more_html').html(option);
                }else{
                $('.more_html').append(option);
                }
                load_more=0;
                if(option){
                    //$("input[name='p']").val(parseInt(p)+1);
                     $("input[name='p']").attr('data',parseInt(p)+1);
                }
                  if(con<10){
                    load_none=1;
                     $('.get_more').html('无更多数据');
                  }
            }
           });
   }
</script>

</body>
</html>